#include <QtGui>
#include "stulogin.h"

StuLogin::StuLogin(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	createActions();
	createTrayIcon();

	ui.setupUi(this);
	ui.lineEdit_password->setEchoMode(QLineEdit::Password);
}

StuLogin::~StuLogin()
{

}

 void StuLogin::createActions()
 {
     //minimizeAction = new QAction(tr("Mi&nimize"), this);
     //connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));

     maximizeAction = new QAction(tr("Ma&ximize"), this);
     connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));

    // restoreAction = new QAction(tr("&Restore"), this);
     //connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));

     quitAction = new QAction(tr("&Quit"), this);
     connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
 }

 void StuLogin::createTrayIcon()
 {
	 trayIconMenu=new QMenu(this);
	 trayIconMenu->addAction(maximizeAction);
	 trayIconMenu->addAction(quitAction);

	 QIcon icon=QIcon(":/StuLogin/trayicon");

	 trayIcon=new QSystemTrayIcon(this);
	 trayIcon->setIcon(icon);
	 trayIcon->setContextMenu(trayIconMenu);
	 trayIcon->setVisible(true);
 }